package com.lm.activiti.boot.cases;

import com.alibaba.fastjson.JSON;
import com.lm.activiti.boot.cases.dto.AAProperties;
import com.lm.activiti.boot.cases.dto.AProperties;
import com.lm.activiti.boot.cases.dto.BProperties;
import com.lm.activiti.boot.cases.dto.ParentProperties;
import lombok.SneakyThrows;
import org.apache.commons.beanutils.BeanMap;
import org.junit.Test;

/**
 * @author lm_jcf
 * @date 2020/3/5 10:55
 */
public class ExtendsTest {


    public ParentProperties testExtends() {
        AProperties aProperties = new AProperties();

        aProperties.setSports("子类属性");
        aProperties.setAge(11);
        return aProperties;
    }

    @Test
    public void test(){
        AProperties aProperties = (AProperties) testExtends();
        System.out.println(JSON.toJSONString(aProperties));

        ParentProperties parentProperties = testExtends();

        System.out.println(JSON.toJSONString(parentProperties));


        AAProperties aa = new AAProperties();

        aa.income();

        System.out.println(aa.getSports());
        System.out.println(aa.getAge());
    }

    @Test
    public void parent(){
        ParentProperties properties = new AProperties();

        System.out.println(properties instanceof BProperties);

        AProperties properties1 = (AProperties) properties;

        System.out.println(properties1 instanceof AProperties);

        ParentProperties parentProperties = new ParentProperties();

        System.out.println(parentProperties instanceof  AProperties);
    }

    @Test
    public void testThread() throws InterruptedException {
        Thread thread = new Thread(){

            @SneakyThrows
            @Override
            public void run() {

                while (true) {
                    System.out.println("1");

                    sleep(1000);
                }
            }
        };

        thread.start();

        Thread.sleep(5 * 1000);

        thread.wait();

        Thread.sleep(5 * 1000);

        thread.notify();
    }

}
